/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import java.util.ArrayList;

public class Hotbar {
    private ArrayList<Gun> hotbar;
    private int selected;
    public Hotbar(){
        hotbar = new ArrayList();
        Gun pick = new Gun(0, 0, 0, "Pick");
        Gun pistol = new Gun(50, 20, 1000, "Pistol");
        hotbar.add(pick);
        hotbar.add(pistol);
    }
    public void add(Gun gun){hotbar.add(gun);}
    public void remove(int index){hotbar.remove(index);}
    public Gun get(int index){return hotbar.get(index);}
    public int getSelected(){return selected;}
    public String getSelectedGun(){return hotbar.get(selected).getClass().getName();}
    public Gun getGunSelected(){return hotbar.get(selected);}
    public void setSelected(String gun){
        for(int i = 0; i < hotbar.size(); i++){
            if(hotbar.get(i).getGunName().equals(gun)){
                selected = i;                
            }
        }   
    }
    public void setSelected(int index){
        selected = index;
    }
    public void reset() {
        for(int i = 2; i < hotbar.size(); i++){hotbar.remove(i);}
    }
}
